$(function () {
    init_data_export();
})

/**初始化数据**/
function init_data_export() {
    var epid = $("#bigEpExport_ids").val();
    var uuid = $("#bigEmpBatchUuid").val();
    if (epid != undefined && uuid != undefined) {
        $.post(ctx+"bigEpExport/viewBalanceEmpRecords",{epid:epid,uuid:uuid},function (r) {
            if (r.code === 0){
                var data = r.msg;
                $("#allBalance").text(data.titlo);
                $("#weiShai").text(data.wei);
                $("#noBalance").text(data.noBalance);
                $("#daibalance").text(data.dai);
                var records = data.records;
                if (records!=null){
                    $.each(records,function (index,val) {
                        var tr = $("<tr></tr>");
                        var td = "<td>"+val.time+"</td><td>"+val.num+"</td><td>"+val.user+"</td>";
                        $("#tbodybalance").append(tr.append(td));
                    });
                }
            }else{
                $JuXue.n_danger(r.msg)
            }
        });
    }else{
        $JuXue.n_warning("获取数据失败")
    }
}

/**结算操作**/
function BalacethisBatchOver() {
    var bpBatchnum = $("#bpBatchnum").val().trim();
    if (bpBatchnum == ""){return $JuXue.n_danger("请输入有效的数字")}
    var epid = $("#bigEpExport_ids").val();
    var uuid = $("#bigEmpBatchUuid").val();
    if (epid != undefined && uuid != undefined) {
        $.post(ctx+"bigEpExport/banlanceBigRecords",{epid:epid,uuid:uuid,num:bpBatchnum},function (r) {
            if (r.code === 0){
                $JuXue.n_success("结算成功");
                $JuXue.refreshTable("bigEmpRecordsTable");
                $("#bigEpExport-detail-div").modal("hide");
            }else{
                $JuXue.n_danger(r.msg)
            }
        });
    }else{
        $JuXue.n_warning("获取数据失败")
    }
}

